
package jugueteria_lm;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.JOptionPane;


public class Jugueteria_Datos {
    Conexion conectar = new Conexion();
    
    public int Elimina_Datos(String tabla,String id, String cod){  
            try {                
                PreparedStatement eliminar = conectar.getConnection().prepareStatement("delete from "+ tabla +" where "+id+" = ?");            
                eliminar.setString(1, cod);                   
                eliminar.execute();
                eliminar.close();     
                JOptionPane.showMessageDialog(null,"Se Elimino Exitosamente");
            }catch(SQLException e){
                JOptionPane.showMessageDialog(null,"Error al Eliminar");
            }            
   return 1;
    }
}
